import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
import ParentView from '@/components/ParentView';

/**
 * Note: 路由配置项
 *
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true               // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'             // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    noCache: true                // 如果设置为true，则不会被 <keep-alive> 缓存(默认 false)
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
  }
 */

// 公共路由
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: (resolve) => require(['@/views/redirect'], resolve)
      }
    ]
  },
  {
    path: '/login',
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/error/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/error/401'], resolve),
    hidden: true
  },
  // {
  //   path: '',
  //   component: Layout,
  //   redirect: 'index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: (resolve) => require(['@/views/index'], resolve),
  //       name: '首页',
  //       meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/user',
  //   component: Layout,
  //   hidden: true,
  //   redirect: 'noredirect',
  //   children: [
  //     {
  //       path: 'profile',
  //       component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
  //       name: 'Profile',
  //       meta: { title: '个人中心', icon: 'user' }
  //     }
  //   ]
  // },
  // {
  //   path: '/dict',
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'type/data/:dictId(\\d+)',
  //       component: (resolve) => require(['@/views/system/dict/data'], resolve),
  //       name: 'Data',
  //       meta: { title: '字典数据', icon: '' }
  //     }
  //   ]
  // },
  // {
  //   path: '/job',
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'log',
  //       component: (resolve) => require(['@/views/monitor/job/log'], resolve),
  //       name: 'JobLog',
  //       meta: { title: '调度日志' }
  //     }
  //   ]
  // },
  // {
  //   path: '/gen',
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'edit/:tableId(\\d+)',
  //       component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
  //       name: 'GenEdit',
  //       meta: { title: '修改生成配置' }
  //     }
  //   ]
  // }



//   {
//     path: '/login',
//     component: () =>
//         import ('@/views/page/login/index'), 
//     hidden: true
// },

// {
//     path: '/404',
//     component: () =>
//         import ('@/views/page/404'),
//     hidden: true
// },

// 首页
{
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    meta: { title: '首页', icon: 'dashboard' },
    children: [
        {
        path: 'dashboard',
        name: 'Dashboard',
        component: () =>
            import ('@/views/page/dashboard/index'),
        meta: { title: '首页', icon: 'dashboard'}
        },
    ]
},

// 账号管理 accountManagement  expireRemind accountSet
{
    path: '/expireRemind',
    component: Layout,
    redirect: 'expireRemind',
    meta: { title: '账号管理', icon: 'el-icon-s-order',index:'2'  },
    children: [{
            path: 'expireRemind',
            name: 'expireRemind',
            component: () =>
                import ('@/views/page/accountManagement/expireRemind'),
            meta: { title: '到期提醒', icon: 'el-icon-s-order' }
        },
        {
            path: 'accountSet',
            name: 'accountSet',
            component: () =>
                import ('@/views/page/accountManagement/accountSet'),
            meta: { title: '账号设置', icon: 'el-icon-s-claim' }
        }
    ]
},

// 样式管理 StyleManagement
{
    path: '/StyleManagement',
    component: Layout,
    redirect: '/StyleManagement',
    meta: { title: '样式管理', icon: 'table',index:'3' },
    children: [{
        path: 'StyleManagement',
        name: 'StyleManagement',
        component: () =>
            import ('@/views/page/StyleManagement'),
        meta: { title: '样式管理', icon: 'table'}
    }]
},

// 动态监控 dynamicMonitoring  MissionControl equipmentOffline
{
    path: '/missionControl',
    component: Layout,
    redirect: 'missionControl',
    meta: { title: '动态监控', icon: 'table',index:'4' },
    children: [{
            path: 'missionControl',
            name: 'missionControl',
            component: () =>
                import ('@/views/page/dynamicMonitoring/missionControl'),
            meta: { title: '任务监控', icon: 'table' }
        },
        {
            path: 'equipmentOffline',
            name: 'equipmentOffline',
            component: () =>
                import ('@/views/page/dynamicMonitoring/equipmentOffline'),
            meta: { title: '离线监控', icon: 'table' }
        },
        {
            path: 'bedStateDiagram',
            name: 'bedStateDiagram',
            component: () =>
                import ('@/views/page/dynamicMonitoring/bedStateDiagram'),
            meta: { title: '床态图', icon: 'table' }
        },
    ]
},

// 系统设置 systemManagement   systemParameter  menuManagement  systemAccount bannerManagement dictionaryManagement
{
    path: '/systemManagement',
    component: Layout,
    redirect: '/systemManagement/systemAccount',
    meta: { title: '系统管理', icon: 'table',index:'5' },
    children: [{
            path: 'systemAccount',
            name: 'systemAccount',
            component: () =>
                import ('@/views/page/systemManagement/systemAccount'),
            meta: { title: '账号管理', icon: 'table' }
        },
        {
            path: 'systemParameter',
            name: 'systemParameter',
            component: () =>
                import ('@/views/page/systemManagement/systemParameter'),
            meta: { title: '系统参数', icon: 'table' }
        },
        {
            path: 'menuManagement',
            name: 'menuManagement',
            hidden:true,
            component: () =>
                import ('@/views/page/systemManagement/menuManagement'),
            meta: { title: '菜单管理', icon: 'table' }
        },
        {
            path: 'dictManagement',
            name: 'dictManagement',
            component: () =>
                import ('@/views/page/systemManagement/dictionaryManagement'),
            meta: { title: '字典管理', icon: 'table' }
        },
        {
            path: 'dictType',
            name: 'dictType',
            hidden: true,
            component: () =>
                import ('@/views/page/systemManagement/dictionarydictType'),
            meta: { title: '字典类型', icon: 'table' }
        },
        {
            path: 'bannerManagement',
            name: 'bannerManagement',
            component: () =>
                import ('@/views/page/systemManagement/bannerManagement'),
            meta: { title: '广告管理', icon: 'table' }
        }
    ]
},

// 人员管理 peopleManagement   oldManManagement staffManagement
{
    path: '/peopleManagement',
    component: Layout,
    redirect: '/peopleManagement/oldManManagement',
    meta: { title: '人员管理', icon: 'table',index:'6' },
    children: [{
            path: 'oldManManagement',
            name: 'oldManManagement',
            component: () =>
                import ('@/views/page/peopleManagement/oldManManagement'),
            meta: { title: '老人管理', icon: 'table' }
        },
        {
            path: 'staffManagement',
            name: 'staffManagement',
            component: () =>
                import ('@/views/page/peopleManagement/staffManagement'),
            meta: { title: '员工管理', icon: 'table' }
        }
    ]
},

// 区域管理  areaManagement  roomManagement  areaSet
{
    path: '/areaManagement',
    component: Layout,
    redirect: '/areaManagement/roomManagement',
    meta: { title: '区域管理', icon: 'table',index:'7' },
    children: [{
            path: 'roomManagement',
            name: 'roomManagement',
            component: () =>
                import ('@/views/page/areaManagement/roomManagement'),
            meta: { title: '房间管理', icon: 'table' },
        },
        {
            path: 'addRoom',
            name: 'addRoom',
            hidden: true,
            component: () =>
                import ('@/views/page/areaManagement/addRoom'),
            meta: { title: '新增房间', icon: 'table' }
        },

        {
            path: 'bed',
            name: 'bed',
            hidden: true,
            component: () =>
                import ('@/views/page/areaManagement/bed'),
            meta: { title: '床位管理', icon: 'table' }
        },
        {
            path: 'areaSet',
            name: 'areaSet',
            component: () =>
                import ('@/views/page/areaManagement/areaSet'),
            meta: { title: '区域设置', icon: 'table' }
        },
        
        {
            path: 'addArea',
            name: 'addArea',
            hidden: true,
            component: () =>
                import ('@/views/page/areaManagement/addArea'),
            meta: { title: '新增区域', icon: 'table' }
        },
        {
            path: 'areaAmend',
            name: 'areaAmend',
            hidden: true,
            component: () =>
                import ('@/views/page/areaManagement/areaAmend'),
            meta: { title: '区域修改', icon: 'table' }
        },
    ]
},
// 服务内容管理 serviceContentManagement
{
    path: '/serviceContent',
    component: Layout,
    redirect: '/serviceContent',
    meta: { title: '服务内容管理', icon: 'table',index:'8' },
    children: [{
        path: 'serviceContent',
        name: 'serviceContent',
        component: () =>
            import ('@/views/page/serviceContentManagement/serviceContent'),
        meta: { title: '服务内容', icon: 'table' }
    }]
},

// 运行日志 runningLog  hardwareLog  seekHelpLog  patrolLog
{
    path: '/runningLog',
    component: Layout,
    redirect: '/runningLog/hardwareLog',
    meta: { title: '运行日志', icon: 'table',index:'9' },
    children: [{
            path: 'hardwareLog',
            name: 'hardwareLog',
            component: () =>
                import ('@/views/page/runningLog/hardwareLog'),
            meta: { title: '硬件日志', icon: 'table' }
        },
        {
            path: 'seekHelpLog',
            name: 'seekHelpLog',
            component: () =>
                import ('@/views/page/runningLog/seekHelpLog'),
            meta: { title: '求助日志', icon: 'table' }
        },
        {
            path: 'seekHelpDetails',
            name: 'seekHelpDetails',
            hidden: true,
            component: () =>
                import ('@/views/page/runningLog/seekHelpDetails'),
            meta: { title: '求助详情', icon: 'table' }
        },
        {
            path: 'patrolLog',
            name: 'patrolLog',
            component: () =>
                import ('@/views/page/runningLog/patrolLog'),
            meta: { title: '巡查日志', icon: 'table' }
        },
        {
            path: 'patrolDetails',
            name: 'patrolDetails',
            hidden: true,
            component: () =>
                import ('@/views/page/runningLog/patrolDetails'),
            meta: { title: '巡查详情', icon: 'table' }
        }
    ]
},


// 404 page must be placed at the end !!!
// { path: '*', redirect: '/404', hidden: true }



]

export default new Router({
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
